package com.jdls.tanhua.web;

import com.github.tobato.fastdfs.domain.conn.FdfsWebServer;
import com.jdls.tanhua.server.VoiceServer;
import com.jdls.tanhua.vo.VoiceVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author 嘉德罗斯
 * @date 2021/11/8
 */
@RequestMapping("/peachblossom")
@RestController
public class VoiceWeb {

    @Autowired
    private VoiceServer voiceServer;



    @PostMapping
    //上传语音
    public ResponseEntity upVoice(MultipartFile soundFile) throws IOException {

        voiceServer.upVoice(soundFile);
        return ResponseEntity.ok(null);

    }

    @GetMapping
    //获取语音
    public ResponseEntity find(){

        VoiceVo voiceVo = voiceServer.find();
        return ResponseEntity.ok(voiceVo);

    }


}
